package com.bluemsun.naturallanguageprocessing.exceptionHandler;

import com.bluemsun.naturallanguageprocessing.common.ServerResponse;
import com.bluemsun.naturallanguageprocessing.util.ExceptionMessageUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class RuntimeExceptionHandler {

    private static final Logger logger = LoggerFactory.getLogger(RuntimeExceptionHandler.class);
    @ExceptionHandler(Exception.class)
    public ServerResponse exception(Exception e){
        e.printStackTrace();
        logger.error(e.toString());
        return ServerResponse.createBySuccessMessage(e.toString());
    }
}
